#ifndef RP2STANDARDMESH_H
#define RP2STANDARDMESH_H

#include "Rp2Foundation.h"
#include "Rp2Geometry.h"
#include "Rp2TriMesh.h"

namespace Rp2
{
class StandardMesh
{
public:
	//StandardMesh();
	StandardMesh(const Attributes& rkAttr, const Transformation* pkTransform = 0);
	~StandardMesh();

    void SetTransformation (const Transformation& rkXFrm);
    const Transformation& GetTransformation () const;

	void AddTriangle(Vector3f* akV, Vector3f* akN, Vector2f* akT);

	// if the vertex is exist(or almost the same) in the vertex list.
	int IsExist(const Vector3f& rkV, const Vector3f& rkN, const Vector2f& rkT);	
	
	// get the number of vertices in use.
	int GetNumVertices();

	// Cube
	TriMesh* Cube(float fRadius);

	// Torus
	TriMesh* Torus(float fMajorRadius, float fMinorRadius, int iNumMajor, int iNumMinor);

	// Sphere
	TriMesh* Sphere(float fRadius, int iSlices, int iStacks);

	// Rectangle
	TriMesh* Rectangle(int iXSamples, int iYSamples, float fXExtent, float fYExtent);

	// Rectangle for rectangle texture
	TriMesh* RectangleTex(int iXPos, int iYPos, int iWidth, int iHeight);

private:
	void TransformData(VertexBuffer* pkVB);

	// attributes
	int m_iVertexQuantity;

	int m_iMaxVertex;	// max workspace
	int m_iNumIndexes; // number of indexes current used
	int m_iNumVertices; // number of vertices current used
	
	Attributes m_kAttr;
	Transformation m_kXFrm;
	VertexBuffer* m_pkVBuffer;
	IndexBuffer* m_pkIBuffer;
	float* m_afData;

};

}


#endif